package com.itheima.xmy.Demo;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.ResourceBundle;

/*## 题目2
将题目一中 `iphone.properties`文件的数据加载到 Properties对中，并遍历打印出来。*/
public class Properties02 {
    public static void main(String[] args) throws IOException {
        Properties properties = new Properties();
//        properties.load(new FileReader(new File("day-11/src/iphone.properties")));
//        properties.forEach((s,v)-> System.out.println(s+"- -"+v));
//        for (Object o : properties.keySet()) {
//            String property = properties.getProperty((String) o);
//            System.out.println(o+"->"+ property);
//        }
        ResourceBundle resourceBundle = ResourceBundle.getBundle("iphone");
        System.out.println(resourceBundle.getString("brand"));
    }
}
